<?php

namespace apiend\modules\shop\controllers;

use Yii;
use apiend\components\Controller;
use common\logics\shop\StandardProductUnit;
use common\models\shop\ShopProductData;

/**
 * 商品（SPU）相关接口
 *
 * @author emhome<emhome@163.com>
 * @since 2.0
 */
class ProductController extends Controller {

    /**
     * SPU详情
     * @return array
     */
    public function actionView($id) {
        return StandardProductUnit::findOrFail($id);
    }

    /**
     * 商品缩略图
     * @view view.php
     * @return mixed
     */
    public function actionThumb($id) {
        return ShopProductData::findOrFail([
            'product_id' => $id
        ]);
    }

}
